#!/usr/bin/bash

if [ -d "$HOME/.nvm" ]; then
    echo "nvm 已经安装"
else
    echo "nvm 未安装，开始安装"
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] &&\. "$NVM_DIR/nvm.sh"
fi

if [ $(node -v) != "v20.12.2" ]; then
    nvm install 20.12.2
    nvm use 20.12.2
fi

rm -rf dist
cd ascend-llm-web/
npm install
npm run build
cp -r dist ../